<template>
	<view class="cont_img_box" v-if="str?true:false">
		<image @click="seeImg(imgIndex)" v-for="(imgItem,imgIndex) in list" class="cont_img" :src="imgItem" :key="imgIndex"
			mode="aspectFill"></image>
	</view>
</template>

<script>
	import { uniPreview } from '@/utils/uniPromise';
	export default {
		props: {
			str: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				list: []
			};
		},

		mounted() {
			if (this.str) {
				if (Array.isArray(this.str)) {
					this.list = this.str
				} else {

					this.list = this.str.split(',')
				}
			}
		},

		methods: {
			seeImg(index) {
				uniPreview(index, this.list);
			}
		}
	};
</script>

<style scoped lang="scss">
	.cont_img_box {
		display: flex;
		flex-wrap: wrap;
		align-items: center;

		.cont_img {
			width: 120rpx;
			height: 120rpx;
			margin-right: 20rpx;
			margin-bottom: 10rpx;
		}
	}
</style>
